from hocabul.models import School, Course, Department, UserProfile
import parse_koc_courses

ECON = 'economics'
MATH = 'mathemat.'

instructors = [
('jack', 'ojalvo', [ECON,MATH]),
('eytan', 'daniyalzade', [ECON,MATH]),
('ahmet', 'kazanc',[ECON]),
('naz', 'kaplan', [MATH]),
('berk', 'atikoglu',[MATH])              
]

school = School.objects.filter(name="koc university", id=1)[0]
for instructor in instructors:
  up = UserProfile(first_name=instructor[0], last_name=instructor[1], 
                   username=instructor[0], email=("%s.gmail.com" % instructor[0]),
                   password=instructor[0], school=school)
  up.save()
  for course in instructor[2]:
    department = Department.objects.filter(school=school, name=course)[0]
    all_courses = department.courses.all()
    for course_obj in all_courses: 
      up.courses.add(course_obj)
  
  
